home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / netzwerk / tcp-ip / slipcall / contrib / cleanup.rexx
Encoding:
OS/2 REXX Batch file  |  1996-02-26  |  1.8 KB  |  73 lines

  1. /*-----------------------------------------------------------------*/
  2. /* CleanUp.rexx */
  3. /* extract necessary information from a login file */
  4. /* 951225   */
  5. /* hansmbg@algonet.se   */
  6. /* you can use this in two ways: */
  7. /* 1. handle the files in scripts, or  */
  8. /* 2. RX >where_ever_you_want_OUTPUT  CleanUp.rexx   */ 
  9.  
  10. /* define input, output and dummy files */
  11.  
  12. filename = 'ram:Algonet.login'
  13. strippedfile = 'ram:stripped.login'
  14. dummyfile = 'T:earlier.logins'
  15.  
  16. /* define lookup_strings, = lines to save  */
  17.  
  18. lookup_str_1 = 'Last login: '
  19. lookup_str_2 = 'Totalt utnyttjande ='
  20. lookup_str_3 = 'Fri tid utnyttjad = '
  21.  
  22.  
  23. /*--------  NO TRESPASSING !! ---------------*/ 
  24.  
  25.  
  26. /* calculate length  */
  27. str_len_1 = length(lookup_str_1)
  28. str_len_2 = length(lookup_str_2)
  29. str_len_3 = length(lookup_str_3)
  30.  
  31.  
  32. if ~open('in',filename,READ) then do
  33.    say ' * Error!   File ''' || filename || ''' not found.'
  34.    exit
  35.    end
  36.  
  37. /* delete earlier file  */
  38. address command 'Delete >NIL: ' || strippedfile
  39.  
  40. open('out',strippedfile,WRITE)
  41.  
  42. /* lookup and save the wanted information */
  43. do while ~eof('in')
  44.    instring = readln('in')
  45.    jfr = compare(lookup_str_1,instring,)
  46.    if jfr>str_len_1 then do
  47.       writeln('out',instring)
  48.       end
  49.    jfr = compare(lookup_str_2,instring,)
  50.    if jfr>str_len_2 then do
  51.       writeln('out',instring)
  52.       end
  53.    jfr = compare(lookup_str_3,instring,)
  54.    if jfr>str_len_3 then do
  55.       writeln('out',instring)
  56.       end
  57. end
  58.  
  59. close('out')
  60. close('in')
  61.  
  62. /* done, store it while the system runs.. */
  63. address command 'Type >>' || dummyfile || ' ' || filename
  64. address command 'Delete >NIL: ' || filename
  65.  
  66. /* peek, or use for '>' file direction  */
  67. address command 'type ' || strippedfile
  68.  
  69. /*-----------------------------------------------------------------*/
  70. /*-----------------------------------------------------------------*/
  71.  
  72.  
  73.